1. Field of the Invention
The present invention relates generally to a method of employing multiple execution environments within a computer system and, more particularly, to a method that utilizes meta protected instructions to switch the entire context of a microprocessor between multiple hardware execution environments.
2. Description of the Related Art
Originally, computers were custom designed to perform a single task such as accounting, inventory control or trajectory calculation. Each system was sold to fit a particular purpose and was programmed with software that was not suited for use with any other computer or task. The advantages of hardware and software standardization soon became apparent.
When the early computer companies began producing multiple processing devices based upon the same design, it became possible to reuse portions of computer software as well. This development lead to the creation of operating systems (OSs), a collection of software that handles elementary computer functions such as reading keyboard input, producing video display output and reading and writing instructions and data from memory. In short, the OS is the program that xe2x80x9crunsxe2x80x9d the computer.
The standardization of OSs enabled multiple applications to be written that could run on the same computer. The early computers were very expensive, so designers developed methods to allow multiple users to share the expense. This cooperation, or xe2x80x9ctimesharing,xe2x80x9d was informal and procedural at first, for example sales staff using the computer during the day for point-of-sale (POS) transactions and the accounting department using the computer at night for billing. It was not long before computers and OSs were developed to support more advanced timesharing schemes.
Operating systems, such as UNIX developed by ATandT Bell Laboratories of Murray Hill, N.J., enable multiple users and multiple programs to access computer resources by means of a process called xe2x80x9cmultitaskingxe2x80x9d in a fashion that appears simultaneous to users. Multitasking is typically accomplished by a method called task switching, which often utilizes xe2x80x9ctime slicing.xe2x80x9d The UNIX OS divides the available processor time into slices and allows each application or user a slice. If a program has reached the end of its time slice without finishing its processing, hardware and software variables such as instruction and data registers are saved so that they can be restored when the interrupted application""s turn comes around again and it resumes processing. The entire process is also called xe2x80x9ccontext switchingxe2x80x9d although this term also can refer to the practice of switching between active applications on a computer desktop windowing system such as the Windows OS published by Microsoft Corporation of Redmond, Wash.
One problem that arises on a multitasking computer system is incompatibility of programs. For example, although a computer can run multiple programs, it is difficult to simultaneously run one program designed for the Windows OS and another program designed for UNIX. Typically, a computer system must be running one OS or another but not both. If two OS-incompatible programs need to be run at the same time, an xe2x80x9cemulatorxe2x80x9d is often used. An emulator translates commands for one OS to another. One problem is that a program utilizing an emulator typically runs much slower than it would otherwise.
Another problem that arises in a multitasking environment is memory management. A multitasking OS should ensure that an application does not inadvertently corrupt the memory space of another application or the OS itself. Early personal computers (PCs) ran only one program at a time and operated in xe2x80x9crealxe2x80x9d mode. In xe2x80x9crealxe2x80x9d mode, a memory request contains only the address that needs to be accessed and the OS retrieves the requested memory directly. Current OSs typically operate in a xe2x80x9cprotectedxe2x80x9d mode, which means that a memory request does not point to a specific area of memory but contains an index into a xe2x80x9cdescriptorxe2x80x9d table. A descriptor table entry contains the actual address of the requested memory. Included within a descriptor table entry are xe2x80x9caccessxe2x80x9d bits that specify an access level, typically a value between 0 and 3, that a requesting process is required to have to access that specific memory location. The OS compares the access bits sent with the memory request with the access bits in the descriptor table entry. For example, a memory request with the access bits set to a 3 cannot access a memory space that has an access level of 0. An access level of 3 may also indicate to the operating system that the requesting application is not allowed to access memory that is owned by another application, thus preventing one application from corrupting the memory space of another with the same access level.
Briefly, a microprocessor provides a process that switches the microcontroller between multiple protected mode execution contexts or environments by employing xe2x80x9cmeta protectedxe2x80x9d instructions (xe2x80x9cmeta instructionsxe2x80x9d) and multiple registers sets. Although some processors such as the Z80 manufactured by Zilog Corporation of Campbell, Calif., contain multiple data register sets, current microprocessors have only a single set of control registers and active descriptors, limiting the microprocessor to maintaining a single execution environment at any particular time. Here, a meta virtual machine (MVM) is provided to emulate multiple protected mode sessions by managing the time between different protected mode execution contexts. The system thereby appears to provide multiple processors existing at the same time.
A meta protected instruction contains information indicating to a microprocessor that a specific execution context is required or preferred. Upon receipt of the meta instruction, the microprocessor switches to a special context called a meta virtual machine (MVM). The MVM then executes a series of instructions that switch the microprocessor to the required or preferred execution context, thus enabling the microprocessor to execute the instruction in the proper execution context.
One advantage of this technique is that instructions that either cannot execute or execute inefficiently in one execution environment can be supported in an efficient manner by a different execution environment, eliminating the need for an emulator. For example, a user might run Microsoft Word published by Microsoft Corporation using the Microsoft Windows OS on a UNIX-based web server. Utilizing the context switch, each operating system views itself as the only operating system.